<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="" />
    <meta name="author" content="ChongMing" />
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="full-screen" content="yes">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-fullscreen" content="true">
    <meta name="360-fullscreen" content="true">
    <title>会员中心</title>
</head>
<link rel="stylesheet" href="../css/framework7.ios.min.css">
<link rel="stylesheet" href="../css/framework7.ios.colors.min.css">
<link rel="stylesheet" href="../css/my-app.css">
<link rel="stylesheet" href="../css/reset.css">
<link rel="stylesheet" href="../css/swiper-3.3.1.min.css">
<link rel="stylesheet" href="css/membercenter.css">
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../js/jquery.mobile-1.4.3.js"></script>
<script type="text/javascript" src="../js/swiper-3.3.1.jquery.min.js"></script>
<script type="text/javascript" src="js/membercenter.js"></script>
<script type="text/javascript" src="../js/jquery.cookie.js"></script>
<!--<script src="js/jQuery-jcMarquee.js"></script>-->
<script src="js/jquery.kxbdMarquee.js"></script>
<script>
    $(function(){
//        $("#marquee").kxbdMarquee({
//            isEqual:true,         //所有滚动的元素长宽是否相等,true,false
//            loop:0,                 //循环滚动次数，0时无限
//            direction:"left",       //滚动方向，"left","right","up","down"
//            scrollAmount:1,     //步长
//            scrollDelay:20        //时长
//        });
        var uid = $.cookie("local_userId");
        $("#marquee2").kxbdMarquee({
            isEqual:false,         //所有滚动的元素长宽是否相等,true,false
            loop:0,                 //循环滚动次数，0时无限
            direction:"left",       //滚动方向，"left","right","up","down"
            scrollAmount:1,
            scrollDelay:40
        });
//        倒计时
        membercenter.showtime()
//        首页数据
        membercenter.get('memberCenter/index',{uid:uid},function(res){
            if(res.ret==0){
                console.log(res);
                var data = res.data;
                $('.membercenter .personaldata .userinfor .left .name_time .name').html(data.user_name);
                $('.membercenter .personaldata .userinfor .left .head_pic').attr('style',' background: url('+data.avatar_file+') center; background-size: cover;');
                $('.membercenter .personaldata .userinfor .left .name_time .time').html(data.service_start+'-'+data.service_end);
                $('.membercenter .personaldata .userinfor .right p').html(data.product_name)
                var card_l = data.normal_card.length
                var card = data.normal_card;
                var page = Math.ceil(card_l/4);
                var page_all ='';
                for(var i =1;i<=page;i++){
                    var g = (i-1)*4;
                    page_all =  page_all+'<div class="swiper-slide swiper-slide-active" style="width: 320px;"><div class="content">';
                    for(var j=g;j<=g+3;j++){
                        if(j<card_l){
                            page_all = page_all+ '<div class="box" data-id="'+card[j].product_id+'"><img src="'+card[j].thumb_img+'"><p>'+card[j].product_name+'</p></div>  ';
                        }
                    }
                    page_all = page_all+'</div></div>';
                }
                $('.swiper-wrapper').append(page_all);
                var mySwiper = new Swiper ('.swiper-container', {
                    direction: 'horizontal',
                    loop: false,
                    // 如果需要分页器
                    pagination: '.swiper-pagination'
                });
                $.each(data.promotion_card,function(i,t){
                    $('.membercenter .couponcard').append('<div data-id="'+ t.product_id+'" class="divcard1 public"><img src="'+ t.thumb_img+'"><p class="name">'+ t.product_name+'</p><div class="price"><del>'+ t.origin_total_amount+'元</del><span>'+ t.total_amount+'元</span></div></div>')
                });
                $('.membercenter .countdown').attr('data-time',data.diff_end_promotion);
                $('.membercenter .servicecontent').html('<p class="p1">服务：<a class="ui-link">'+data.times+'次</a><b>'+ data.service_content+'</b></p><p class="p2">范围：<b>'+data.service_range+'</b></p>')
                var time = data.diff_end_promotion;
                setInterval(function(){
                    time--
                    $('.membercenter .countdown').attr('data-time',time);
                    membercenter.showtime(time);
                },1000);
                $('.membercenter .personaldata .userinfor .right img').attr('src',data.min_product_img);
                $('.membercenter .balance .div1 img').attr('src',data.max_product_img);
                $('.membercenter .balance .div1 p a').html(data.balance);
                $('#marquee2 ul').append('<li>'+ data.promotion_text+'</li><li>'+ data.promotion_text+'</li><li>'+ data.promotion_text+'</li>');
                $("#marquee2").kxbdMarquee({
                    isEqual:false,         //所有滚动的元素长宽是否相等,true,false
                    loop:0,                 //循环滚动次数，0时无限
                    direction:"left",       //滚动方向，"left","right","up","down"
                    scrollAmount:1,
                    scrollDelay:40
                });
            }
            else{
                //alert(res.msg);
                console.log(res);
//                if(res.errcode==6001){
//                    setInterval(function(){
//                        location.href ='../login.html';
//                    },300);
//                }
                if(!$.cookie("local_userId")){
                    setInterval(function(){
                        location.href = "../login.html";
                    },200);
                }
            }
        });
//        弹幕接口
        membercenter.get('memberCenter/getMemberBarrageList',{page_index:1},function(res){
            if(res.ret==0){
                console.log(res);
                var data = res.data;
                $.each(data,function(i,t){
                    $('.membercenter .barrage ul').append('<li><div class="strip"><div style=" background: url('+ t.avatar+') center; background-size: cover;" class="headpic"></div><div class="center"><p class="p1">'+ t.mobile+'</p><p class="p2">(成功'+ t.product_name+')</p></div><img src="'+ t.icon+'" class="grade"></div></li>');
                    setInterval(function(){
                        $('.membercenter .barrage ul li').eq(i*2).css('marginTop','10vw')
                    },100);
                });
                $("#marquee1").kxbdMarquee({
                    isEqual:true,         //所有滚动的元素长宽是否相等,true,false
                    loop:0,                 //循环滚动次数，0时无限
                    direction:"left",       //滚动方向，"left","right","up","down"
                });
            }
            else{
                alert(res.msg);
            }
        });
//        首页点击充值
        $('.membercenter .balance .div2').click(function(){

            if($.cookie("is_wechat")==1){
                location.href = 'http://www.ekangjiuyi.net/EKang2.0/hospital_nurse/recharge.html'
            }else{
                $.ajax({
                    type: 'GET',
                    url:  url + '/diagnosis/getcharge/',
                    data: {         // 需要于客户端同步
                        order_id: 0,
                        pay_method:"wx_pub",
                        uid:uid,
                        success_url:'http://www.ekangjiuyi.net/EKang2.0/hospital_nurse/recharge.html'
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if(result==0){
                            alert('ok')
                        }else{
                            console.log(result.msg)
                        }
                        var url = result.data.location_url;
                        location.href = url;
                    }
                });
            }
        });
    });
</script>
<style>
    .swiper-container {
        width: 100%;
    }
    .swiper-container-horizontal>.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction {
        bottom: 2vw;
    }
    .swiper-pagination-bullet-active {
        opacity: 1;
        background: #44b181;
    }
    .swiper-pagination-bullet {
        background: #44b181;
    }
    #marquee2{overflow:hidden; }
    #marquee2 ul li{float:left; padding-right: 10px}
</style>
</body>
<body style=" background: #ebebeb;  margin: auto;-webkit-overflow-scrolling: touch;overflow: scroll;">
<div class="membercenter">
    <!--用户简介-->
    <div class="personaldata">
        <div class="userinfor">
            <div class="left">
                <div style=" background: url(img/mrtx.png) center; background-size: cover;" class="head_pic"></div>
                <div class="name_time">
                    <p class="name"></p>
                    <p class="time"></p>
                </div>
            </div>
            <div class="right">
                <img src="">
                <p></p>
            </div>
        </div>
        <div class="servicecontent">
            <p class="p1"></p>
            <p class="p2"></b></p>
        </div>
    </div>
    <!--充值信息-->
    <div class="balance">
        <div class="div1 public">
            <img src="">
            <p>当前会员余额：<a></a></p>
        </div>
        <div class="div2 public">
            <img src="img/icon2.png">
            <div class="win">
                <div class="animate" >
                    <div id="marquee2">
                        <ul>

                        </ul>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <!--弹幕-->
    <div class="barrage" id="marquee1">
            <ul>
                <!--<li>-->
                    <!--<div class="strip">-->
                        <!--<div style=" background: url(img/zwt.png) center; background-size: cover;" class="headpic"></div>-->
                        <!--<div class="center">-->
                            <!--<p class="p1">137****2446</p>-->
                            <!--<p class="p2">(成功充值991元)</p>-->
                        <!--</div>-->
                        <!--<img src="img/icon1.png" class="grade">-->
                    <!--</div>-->
                <!--</li>-->
                <!--<li>-->
                    <!--<div class="strip">-->
                        <!--<div style=" background: url(img/zwt.png) center; background-size: cover;" class="headpic"></div>-->
                        <!--<div class="center">-->
                            <!--<p class="p1">137****2446</p>-->
                            <!--<p class="p2">(成功充值992元)</p>-->
                        <!--</div>-->
                        <!--<img src="img/icon1.png" class="grade">-->
                    <!--</div>-->
                <!--</li>-->
            </ul>
        <!--<div id="Marquee_x">-->
            <!---->
        <!--</div>-->
    </div>
    <!--健康卡-->
    <div class="membercard">
        <div class="tit">
            <div class="left">健康卡</div>
            <a href="explain.html" data-ajax="false" class="right">说明</a>
        </div>
        <div class="allcard">
            <div class="swiper-container">
                <div class="swiper-wrapper">

                </div>
                <div class="swiper-pagination"></div>
            </div>
        </div>
    </div>
    <!--会员抢购-->
    <div class="Panicbuying">
        <div class="tit">
            <div class="left">会员抢购</div>
            <a data-ajax="false" href="panicbuying.html" class="right">更多</a>
        </div>
        <div class="countdown">
            <p>距离结束</p>
            <div class="time" id="countdown">
                <div class="hour public"></div>
                <div class="dd">:</div>
                <div class="minute public"></div>
                <div class="dd">:</div>
                <div class="second public"></div>
            </div>
        </div>
        <div class="couponcard">

        </div>
    </div>
    <!--四个板块-->
    <div class="botbox">
        <div class="con">
            <div class="box1 public">
                <img src="">
                <div class="right">
                    <p class="name">专题活动</p>
                    <p class="text">一大波红包一大波红包</p>
                </div>
            </div>
            <div class="box1 public">
                <img src="">
                <div class="right">
                    <p class="name">专题活动</p>
                    <p class="text">一大波红包一大波红包</p>
                </div>
            </div>
            <div class="box1 public">
                <img src="">
                <div class="right">
                    <p class="name">专题活动</p>
                    <p class="text">一大波红包一大波红包</p>
                </div>
            </div>
            <div class="box1 public">
                <img src="">
                <div class="right">
                    <p class="name">专题活动</p>
                    <p class="text">一大波红包一大波红包</p>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>